//
//  VideoView.h
//  thunder_framework
//
//  Created by dragon on 11/10/10.
//  Copyright 2010 Thunder Networking Inc. All rights reserved.
//

#ifndef VIDEOVIEW_H
#define VIDEOVIEW_H

#import <UIKit/UIKit.h>

enum SUBTITLE_TYPE
{
    SUBTITLE_TYPE_TEXT,
    SUBTITLE_TYPE_IMAGE
};
enum FontEffectType
{
    kDefaultFont,
    kBoldFont,
    kItalicFont
};

@interface EkkVideoView:UIView{
	id render;
	CGRect video_rect;
	CGRect video_src_rect;
	long own_buffer;
	unsigned char *buffer;
	CGRect video_logo_rect;
	CGRect video_subtitle_rect;
	unsigned char *video_logo_buffer;
	unsigned char *video_subtitle_buffer;
	CGSize video_logo_size;
	CGSize video_subtitle_size;
    
    // for tvout
    long is_tvout_enable;    // for controller, enable/disable TVout feature.  see method @setup_TVout
    long is_tvout_running;   // running flag
    UIWindow *tv_window;     // external window
    UIWindow *org_SuperView; // video_view's orginal SuperView
    
    //new subtitle
    UILabel *subtitle_lable;
    UIImageView *subtitle_imageview;
    long subt_font_effect;
    unsigned long subt_font_size;
    unsigned long subt_font_color;
    CGFloat zoom;
	
    BOOL is_render_paused;
    BOOL is_rendering;
    
    BOOL is_clearing_black;
    BOOL black_hidden;
}

@property UILabel *subtitle_lable;
@property long is_tvout_running;

- (long) set_video_rect:(CGRect*) rect src_rect_name:(CGRect*)src_rect;
- (long) set_video_logo:(CGRect*)logo_rect logo_buffer_name:(unsigned char *)logo_buffer logo_size_name:(CGSize*)logo_size;
- (long) set_video_subtitle:(CGRect*)subtitle_rect subtitle_buffer_name:(unsigned char *)subtitle_buffer subtitle_size_name:(CGSize*)subtitle_size;
- (long) has_video_rect;
- (unsigned char *) get_video_buffer;
- (long) render_video:(unsigned char *)video_buffer buffer_len:(long)length y:(int)linesize_y u:(int)linesize_u v:(int)linesize_v;
- (long) render_subtitle_pic:(unsigned char*)subtitle_pic_buffer;
- (long) get_video_buffer_mempitch;
- (long) set_video_size_mode:(long)size_mode;
- (long) get_video_size_mode;
- (long) refresh_video;
- (long) open_video_subtitle;
- (long) close_video_subtitle;
- (long) set_video_ps:(long)brightness contrast_name:(long)contrast saturation_name:(long)saturation;
//for tvout 
//detect is tv connected
- (long)detect_TVout;
//enable or disable TVout feature, TVout only work both enable and TV is connected.
- (long) setup_TVout:(long)enable;

//for subtitle; chenqiao 2011-11-10 17:51:15
-(long) create_video_subtitle:(enum SUBTITLE_TYPE)type;
-(long) destory_video_subtitle;
-(long) set_video_subtitle_attribute:(CGRect*)prect fontEffect:(enum FontEffectType)font_effect  fontSize:(unsigned long)font_size fontColor:(unsigned long)font_color;
-(long) render_video_subtitle_image:(char *)image_buffer width:(long)image_width height:(long)image_height location:(CGRect*)prect;
-(long) render_video_subtitle_text:(char *)subtitle location:(CGRect*)prect;

//fix drag bug
-(void) pause_video_render;
-(void) resume_video_render;
-(void) clear_to_black;
-(void) restore_from_black;

@end

#endif
